package gao.xaiolei.dao;

import java.util.List;

import gao.xaiolei.enity.TaskGroup;
import gao.xaiolei.enity.TaskGroupId;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository("ITaskGroupDao")
public interface ITaskGroupDao extends JpaRepository<TaskGroup, TaskGroupId> {

	// 根据任务Id来获取对应的收件组
	@Query("select id.GROUP_ID from TaskGroup where id.TASK_ID=:TASK_ID")
	public List<String> queryGroupByTaskId(@Param("TASK_ID") String TASK_ID);



	// 修改任务的收件组Id
	@Modifying// update或者delete操作，在更新或者删除操作时，此注解必须加
	@Query("delete from TaskGroup where id.TASK_ID = :TASK_ID")
	public void deleteAllByTaskId(@Param("TASK_ID") String TASK_ID);
}
